/*     */ package com.umeng.analytics.a;
/*     */ 
/*     */ import android.content.Context;
/*     */ import android.content.SharedPreferences;
/*     */ import android.content.SharedPreferences.Editor;
/*     */ import android.location.Location;
/*     */ import com.umeng.analytics.j;
/*     */ import com.umeng.common.b;
/*     */ import org.json.JSONException;
/*     */ import org.json.JSONObject;
/*     */ 
/*     */ public final class o
/*     */   implements g
/*     */ {
/*     */   public double a;
/*     */   public double b;
/*     */   public long c;
/*     */   public static final String d = "lng";
/*     */   public static final String e = "lat";
/*     */   public static final String f = "gps_time";
/*     */   private static final String g = "last_gps_change_time";
/*     */ 
/*     */   public o()
/*     */   {
/*     */   }
/*     */ 
/*     */   public o(Location paramLocation)
/*     */   {
/*  33 */     if (paramLocation == null) {
/*  34 */       return;
/*     */     }
/*     */ 
/*  37 */     this.a = paramLocation.getLongitude();
/*  38 */     this.b = paramLocation.getLatitude();
/*     */ 
/*  40 */     this.c = paramLocation.getTime();
/*     */   }
/*     */ 
/*     */   public static o a(Context paramContext)
/*     */   {
/*  49 */     if (!com.umeng.analytics.g.i) {
/*  50 */       return null;
/*     */     }
/*     */ 
/*  53 */     SharedPreferences localSharedPreferences = j.e(paramContext);
/*  54 */     Location localLocation = b.m(paramContext);
/*     */ 
/*  56 */     if (a(localLocation, localSharedPreferences)) {
/*  57 */       return new o(localLocation);
/*     */     }
/*     */ 
/*  60 */     return null;
/*     */   }
/*     */ 
/*     */   public static o b(Context paramContext)
/*     */   {
/*  69 */     if (!com.umeng.analytics.g.i) {
/*  70 */       return null;
/*     */     }
/*     */ 
/*  73 */     SharedPreferences localSharedPreferences = j.e(paramContext);
/*  74 */     o localo = new o();
/*     */ 
/*  76 */     if (!localSharedPreferences.contains("gps_time")) {
/*  77 */       return null;
/*     */     }
/*     */ 
/*  80 */     localo.b = localSharedPreferences.getFloat("lat", 0.0F);
/*  81 */     localo.a = localSharedPreferences.getFloat("lng", 0.0F);
/*     */ 
/*  83 */     localo.c = localSharedPreferences.getLong("gps_time", 0L);
/*     */ 
/*  85 */     localSharedPreferences.edit().remove("gps_time").commit();
/*     */ 
/*  87 */     return localo;
/*     */   }
/*     */ 
/*     */   public static SharedPreferences.Editor a(Context paramContext, SharedPreferences paramSharedPreferences)
/*     */   {
/*  97 */     if (!com.umeng.analytics.g.i) {
/*  98 */       return null;
/*     */     }
/*     */ 
/* 101 */     Location localLocation = b.m(paramContext);
/*     */ 
/* 103 */     if (a(localLocation, paramSharedPreferences))
/*     */     {
/* 105 */       SharedPreferences.Editor localEditor = paramSharedPreferences.edit();
/*     */ 
/* 107 */       localEditor.putFloat("lng", (float)localLocation.getLongitude());
/* 108 */       localEditor.putFloat("lat", (float)localLocation.getLatitude());
/*     */ 
/* 110 */       localEditor.putLong("gps_time", localLocation.getTime());
/*     */ 
/* 112 */       localEditor.commit();
/*     */ 
/* 114 */       return localEditor;
/*     */     }
/*     */ 
/* 117 */     return null;
/*     */   }
/*     */ 
/*     */   static boolean a(Location paramLocation, SharedPreferences paramSharedPreferences)
/*     */   {
/* 128 */     if ((paramLocation != null) && (paramLocation.getTime() > paramSharedPreferences.getLong("last_gps_change_time", 0L)))
/*     */     {
/* 130 */       paramSharedPreferences.edit().putLong("last_gps_change_time", paramLocation.getTime()).commit();
/*     */ 
/* 132 */       return true;
/*     */     }
/*     */ 
/* 135 */     return false;
/*     */   }
/*     */ 
/*     */   public void b(JSONObject paramJSONObject) throws Exception
/*     */   {
/* 140 */     paramJSONObject.put("lng", this.a);
/* 141 */     paramJSONObject.put("lat", this.b);
/*     */ 
/* 143 */     paramJSONObject.put("gps_time", this.c);
/*     */   }
/*     */ 
/*     */   public void a(JSONObject paramJSONObject) throws JSONException {
/* 147 */     if (paramJSONObject == null) return;
/*     */ 
/* 149 */     if (paramJSONObject.has("lng")) {
/* 150 */       this.a = paramJSONObject.getDouble("lng");
/*     */     }
/*     */ 
/* 153 */     if (paramJSONObject.has("lat")) {
/* 154 */       this.b = paramJSONObject.getDouble("lat");
/*     */     }
/*     */ 
/* 157 */     if (paramJSONObject.has("gps_time"))
/* 158 */       this.c = paramJSONObject.getLong("gps_time");
/*     */   }
/*     */ 
/*     */   public boolean a()
/*     */   {
/* 164 */     if ((this.a == 0.0D) && (this.b == 0.0D) && (this.c == 0L)) {
/* 165 */       return false;
/*     */     }
/* 167 */     return true;
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.analytics.a.o
 * JD-Core Version:    0.6.2
 */